Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webarkit/oneeurofilter-ts

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webarkit/oneeurofilter-ts

One euro filter algorithm with typescript support

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

OneEuroFilter-ts

This code is a translation to Typescript of the original code from Jaan Tollander. It's not well tested yet, so I can not assure of the correctness of the code.

Installation

Install with npm:

npm install @webarkit/oneeurofilter-ts

Install with yarn:

yarn add @webarkit/oneeurofilter-ts

Usage

In a typescript file:

// import the OneEuroFilter class into your project
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";

let filterMinCF: number = 0.0001;
let filterBeta: number = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);

/* yourData is the data you want to filter, createData() is a dummy function here, 
use it you method or data instead...
*/
let yourData = createData();

// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);

// then use yourData...

In a javascript file:

// import the OneEuroFilter class into your project
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";

let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);

/* yourData is the data you want to filter, createData() is a dummy function here, 
use it you method or data instead...
*/
let yourData = createData();

// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);
// then use yourData...

in a html script tag with module support:


<script type="importmap">
    {
    "imports": {
        "oef": "https://raw.github.com/webarkit/oneeurofilter-ts/main/dist/OneEuroFilter.mjs",
        }
    }
</script>

// import the OneEuroFilter class into your project

<script type="module">

import { OneEuroFilter } from "oef";

let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);

/* yourData is the data you want to filter, createData() is a dummy function here, 
use it you method or data instead...
*/
let yourData = createData();

// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);

// then use yourData...
</script>

Keywords

FAQs

Package last updated on 10 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc